@echo off

echo =============================================
echo Starting backend and frontend applications...
echo =============================================

REM Create new cmd window for backend service
echo Starting backend application (port 8081)...
start "Backend Service" cmd /k "echo Starting backend service... && java -jar target/ai-platform-backend-1.0.0.jar --server.port=8081"

REM Wait 5 seconds for backend to fully start
echo Waiting for backend service to start...
ping 127.0.0.1 -n 6 > nul

REM Create new cmd window for frontend service
echo Starting frontend application...
start "Frontend Service" cmd /k "echo Starting frontend service... && npm run dev"

echo =============================================
echo Applications started successfully!
echo Backend service running at: http://localhost:8081/
echo Frontend service usually runs at: http://localhost:2180/ or http://localhost:2181/
echo Please access the frontend address in your browser
echo =============================================